import 'package:flutter/material.dart';


import '../../Models/banner.dart';
class ProductCard extends StatelessWidget {
  final HomeBanner product;
  final int productIndex;
  ProductCard(this.product, this.productIndex);
  @override
  Widget build(BuildContext context) {
    // print('${product.title}是否收藏${product.isFavorite}');
    return Card(
      child: Column(
        children: <Widget>[
          FadeInImage(image: NetworkImage(
            product.path,
          ),
          fit: BoxFit.cover,
          placeholder: AssetImage('assets/food.jpg'),
           height: 200.0,
          ),
        
          SizedBox(
            height: 10.0,
          ),
          Row(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              Container(
                child: Text(product.name,
                    style: TextStyle(
                      fontFamily: 'Oswald',
                      fontSize: 26.0,
                    )),
              ),
              SizedBox(
                width: 8.0,
              ),
              Container(
                padding: EdgeInsets.symmetric(horizontal: 6.0, vertical: 2.5),
                //${}执行方法
                decoration: BoxDecoration(
                    borderRadius: BorderRadius.circular(5.0),
                    color: Theme.of(context).accentColor),
                child: Text(
                  '\$${product.name}',
                  style: TextStyle(color: Colors.white),
                ),
              )
            ],
          ),
          Container(
              padding: EdgeInsets.symmetric(horizontal: 4.0, vertical: 2.0),
              decoration: BoxDecoration(
                  border: Border.all(color: Colors.grey, width: 1.0),
                  borderRadius: BorderRadius.circular(3.0)),
              child: Text(product.name)),
          ButtonBar(
            alignment: MainAxisAlignment.center,
            children: <Widget>[
              IconButton(
                  icon: Icon(Icons.info),
                  onPressed: () => Navigator.pushNamed(context,
                      '/product/' + productIndex.toString()) //通过构造方法传递参数
                  ),
             
            ],
          )
        ],
      ),
    );
    ;
  }
}

